<include file="Public/min-header" />
<link href="__PUBLIC__/plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
<script src="__PUBLIC__/plugins/daterangepicker/moment.min.js" type="text/javascript"></script>
<script src="__PUBLIC__/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
<div class="wrapper">
    <include file="Public/breadcrumb"/>
	<section class="content">
       <div class="row"> 
       		<div class="col-xs-12">
	       		<div class="box">
	             <div class="box-header">
	               	 <div class="row">
		  					<div class="col-md-10" style="width:100%;">
		  						<form action="" method="get">
								  	<div class="col-xs-3">
					                    <div class="input-group">
					                      <input type="text" class="form-control pull-right" name="timegap" value="{$timegap}" id="start_time" style="width:250px;">
					                    </div>
				  					</div>	
		                   		 	<div class="col-xs-1">
										<input class="btn btn-primary margin" type="submit" value="确定" style="margin: -2px 35px;"> 
										</div>
 										<button type="button" style="margin-right:15%;" class="btn btn-default pull-right" id="daochu"><i class="fa fa-file-excel-o"></i>&nbsp;导出excel</button>
	                   		 	</form>
                   		 	</div>
		  			</div>
					<div class="row">
						<div class="col-sm-3 col-xs-6">
							&nbsp;&nbsp;&nbsp;成交额：<span style="color:red;">{$price_heji}</span>
						</div>
					</div>
	             </div><!-- /.box-header -->
				 
	             <div class="box-body">
	           	 <div class="row">
	            	<div class="col-sm-12">
		              <table id="list-table" class="table table-bordered table-striped dataTable" role="grid" aria-describedby="example1_info">
		                 <thead>
		                   <tr role="row">     
<!--			                   <th class="sorting" tabindex="0" aria-controls="example1" style="text-align: center;">排行</th>-->
								<th class="sorting" tabindex="0" aria-controls="example1" style="text-align: center;">线路标识</th>
			                   <th class="sorting" tabindex="0" aria-controls="example1" style="text-align: center;">总金额</th>
			                   <th class="sorting" tabindex="0" aria-controls="example1" style="text-align: center;">扣点金额</th>
			                   <th class="sorting" tabindex="0" aria-controls="example1" style="text-align: center;">退货抵扣</th>
			                   <th class="sorting" tabindex="0" aria-controls="example1" style="text-align: center;">实收合计</th>
			                   <th>操作</th>
		                   </tr>
		                 </thead>
						<tbody>
							<?php
								$p =0;
							 ?>
                         <foreach name="list" item="vo" key="k" >
                          <tr role="row" align="center">
							 <td>{$vo.biaoshi_xian}</td>
		                     <td style="color: red;">{$vo.price_heji}</td>
		                     <td style="color: red;">{$vo.koudian_heji}</td>
		                     <td style="color: red;">{$vo.tuihuo_heji}</td>
		                     <td style="color: red;">{$vo.heji}</td>
		                     <td><a target="_blank" href="/Admin/Report/userTop/mobile/{$vo.biaoshi_xian}/timegap/{$timegap}" class="btn btn-info">查看</a></td>
		                   </tr>
		                  </foreach>
						  <tr style="font-weight: bold;">
							  <td colspan="1" style="text-align:right;font-size: 16px;">合计：</td>
							  <td  style="font-size: 16px;color: red;text-align: center;">{$price_hejis}</td>
							  <td  style="font-size: 16px;color: red;text-align: center;">{$koudian_heji}</td>
							  <td  style="font-size: 16px;color: red;text-align: center;">{$tuihuo_heji}</td>
							  <td style="font-size: 16px;color: red;text-align: center;">{$price_heji}</td>
							  <td style="font-size: 16px;color: red;"></td>
						  </tr>
		                   </tbody>
		                 <tfoot>
		                 </tfoot>
		               </table>
	               </div>
	          </div>
              <div class="row">
              </div>
	          </div>
	        </div>
       	</div>
       </div>
   </section>
</div>
<script type="text/javascript">
$(document).ready(function() {
	$('#start_time').daterangepicker({
		format:"YYYY-MM-DD HH:mm",
		singleDatePicker: false,
		showDropdowns: true,
		minDate:'2021-01-01 00:00',
		maxDate:'2030-01-01 00:00',
		startDate:'{:date("Y-m-d")} 00:00',
        showWeekNumbers: true,
        timePicker: true,
        timePickerIncrement: 1,
        timePicker12Hour: false,
        ranges: {
           '今天': [moment(), moment()],
           '昨天': [moment().subtract('days', 1), moment().subtract('days', 1)],
           '最近7天': [moment().subtract('days', 6), moment()],
           '最近30天': [moment().subtract('days', 29), moment()],
           '上一个月': [moment().subtract('month', 1).startOf('month'), moment().subtract('month', 1).endOf('month')]
        },
        opens: 'right',
        buttonClasses: ['btn btn-default'],
        applyClass: 'btn-small btn-primary',
        cancelClass: 'btn-small',
	    locale : {
            applyLabel : '确定',
            cancelLabel : '取消',
            fromLabel : '起始时间',
            toLabel : '结束时间',
            customRangeLabel : '自定义',
            daysOfWeek : [ '日', '一', '二', '三', '四', '五', '六' ],
            monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月','七月', '八月', '九月', '十月', '十一月', '十二月' ],
            firstDay : 1
        }
	});
 $("#daochu").click(function(){
	 layer.load();
	 var time = $('#start_time').val();
	 var url = '/index.php/Admin/Report/export_userTop_xian?timegap='+time
	 $.ajax({
		 type: "GET",
		 url: url,
		 dataType: "json",//后台处理后返回的数据格式
		 success: function (data){
			 var $a = $("<a>");
			 $a.attr("href", data.file);
			 $a.attr("download", data.filename);
			 $("body").append($a);
			 $a[0].click();
			 $a.remove();
			 layer.closeAll('loading');
		 },
		 error: function (msg){
		 }
	 })
  });
});
</script>
</body>
</html>